import 'package:flutter/material.dart';

class DColor {

  /// 主副色调
  static const Color primary = Color(0xFFED5555);
  static const Color second = Color(0xFFDB4F4F);
  static const Color lightPrimary = Color(0xFF353a4c);
  static const Color bgColor = Color(0xFFF0F2F4);

  /// 前景色 文本颜色
  static const Color text = Color(0xFF080E34);
  static const Color title = Color(0xFF252E36);
  static const Color body = Color(0xFF666666);
  static const Color descText = Color(0xff999999);
  static const Color hitText = Color(0xff9a9a9a);
  static const Color money = Color(0xFFFF9191);
  static const Color link = Color.fromARGB(255, 29, 15, 221);

  /// 边框颜色 线条颜色
  static const Color border = Color(0xFFDDDDDD);
  static const Color line = Color(0xFFEEEEEE);
  static const Color grayLine = Color(0xFFF0F0F0);
  static const Color darkLine = Color(0xFF3A3C3D);
  static const Color vLine = Color(0xFF979797);

  /// 背景颜色
  static const Color red = Color(0xFFF0382E);
  static const Color oliver = Color(0xFF65CC85);
  static const Color orange = Color(0xFFFF8811);
  static const Color purple = Color(0xFF7639E1);
  static const Color gray = Color(0xFFB2B1B1);

  static const Color price = Color(0xFFFF8811);

  static var primaryColor = MaterialColor(primary.value, const <int, Color> {
    50: primary,
    100: primary,
    200: primary,
    300: primary,
    400: primary,
    500: primary,
    600: primary,
    700: primary,
    800: primary,
    900: primary,
  });
}

class HexColor extends Color {
  HexColor(final String hexColor) : super(_getColorFromHex(hexColor));

  static _getColorFromHex(String hexColor) {
    hexColor = hexColor.toUpperCase().replaceAll('#', '');
    if (hexColor.length == 6) {
      hexColor = 'FF$hexColor';
    }
    return int.parse(hexColor, radix: 16);
  }
}